<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>购物商城</title>
    <!-- 引入Bulma CSS（这里使用CDN） -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.3/css/bulma.min.css">
    <style>
        .navbar-brand .navbar-item {
            font-size: 1.5rem;
            font-weight: bold;
        }
        .navbar.is-fixed-top {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }
        .card:hover {
            transform: scale(1.05);
            transition: transform 0.2s;
        }
        .card-footer-item:hover {
            background-color: #f5f5f5;
        }
        .section {
            margin-top: 4rem; /* Ensure content is not hidden behind the fixed navbar */
        }
    </style>
</head>
<body>
<!-- 导航栏 -->
<nav class="navbar is-primary is-fixed-top" role="navigation" aria-label="main navigation">
    <div class="navbar-brand">
        <a class="navbar-item" href="/">
            购物商城
        </a>
        <a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
            <span aria-hidden="true"></span>
        </a>
    </div>

    <div id="navbarBasicExample" class="navbar-menu">
        <div class="navbar-start">
            <a class="navbar-item" href="/student/zhu">
                首页
            </a>
            <a class="navbar-item" href="/shop/product/addProducts">
                添加商品
            </a>
        </div>
    </div>
</nav>

<!-- 主要内容 -->
<div class="section">
    <div class="columns is-multiline">
        <!-- 使用Bulma的卡片组件和列布局 -->
        <div class="column is-one-third" th:each="product: ${products}">
            <div class="card">
                <div class="card-image">
                    <figure class="image is-4by3">
                        <img th:src="@{${product.filepath}}" alt="Product Image">
                    </figure>
                </div>
                <div class="card-content">
                    <div class="media">
                        <div class="media-content">
                            <p class="title is-5" th:text="${product.name}"></p>
                            <p class="subtitle is-6" th:text="${product.description}"></p>
                        </div>
                    </div>
                    <div class="content">
                        <strong>价格: </strong><span th:text="${product.price}"></span>
                    </div>
                </div>
                <footer class="card-footer">
                    <a class="card-footer-item" th:href="@{'/shop/product/deleteProducts/'+${product.id}}">删除</a>
                    <a class="card-footer-item" th:href="@{|/shop/product/updateProducts/${product.id}|}">更新</a>
                </footer>
            </div>
        </div>
    </div>
    <div class="buttons is-centered mt-5">
        <a class="button is-success" href="/shop/product/addProducts">添加商品</a>
    </div>
</div>
</body>
</html>
